package com.richpencil.config;

import com.richpencil.utils.IdHelper;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConfigurationProperties(prefix = "projectinfo.mp")
@Data
public class ProjectConfigInfo {

    @Autowired
    YmlProperties ymlProperties;

    public String domain="";
    public String authorizeurl="";
    public String redirecturl="";
    public String notifyurl="";
    public String vueurl="";
    public String uepath="";

    /*    public String testdomain="";
        public String testauthorizeurl="";
        public String testredirecturl="";
        public String testnotifyurl="";
        public String testvueurl="";
        public String testuepath="";*/
    public String serverip="";
    public String certpath="";
    public boolean ismp=false;

    public String appid="";
    public String mchid="";
    public String appsecrect="";
    public String appid3="";
    public String appsecrect3="";
    //public boolean ismpdebug=false;
    //public boolean isdebug=false;
    //public boolean isdebug(){

    public String kdappid="";
    public String kdappsecrect="";

    public String k100key="";
    public String k100customer="";
    public String k100secret="";
    public String k100userid="";



    //}
    public boolean IsDmrEnv(){

        String Env=this.getEnv().toLowerCase();

        if(Env.contains("dmr")){
            return true;
        } else {
            return false;
        }


    }



    public boolean isdebugmode(){

        String Env=this.getEnv();
        if("dev".equals(Env)||"local".equals(Env)) {
            return true;
        } else {
            return false;
        }
    }

    public String getEnv(){

        return this.ymlProperties.getEnv();
    }


    public boolean istestmode(){
        return this.istest;
    }

    public String uepath(){

        return uepath;
    }

    public boolean istest=false;



    public String vueurl(){

        return  this.vueurl;

    }
    public String entryurl(String fid){

        String prefix="/sapi/front"+"?uuid="+ IdHelper.Uid()+"&fid="+fid;
        return  this.domain+prefix;

    }

}